public class WuHantoBeiJing implements Transport{

    public WuHantoBeiJing() {
        super();
    }

    @Override
    public int selfDrive() {
        return 500;
    }

    @Override
    public int bus() {
        return 300;
    }

    @Override
    public int train() {
        return 400;
    }

    @Override
    public int flight() {
        return 1000;
    }

    public String getMethodName(int price) {
        if(price==300) {
            return "selfDrive";
        }
        if(price==400) {
            return "bus";
        }
        if(price==500) {
            return "train";
        }
        if(price==1000) {
            return "flight";
        }
        return "wrong price";
    }

    public String choseTransport(int budget) {
        String transportMethod = null;
        int[] price = new int[]{selfDrive(), bus(), train(), flight()};
        for(int money: price) {
            if(budget>=money) {
                transportMethod = getMethodName(money);
            }
        }
        return transportMethod;
    }
}
